package com.api.oa.mapper;


import com.api.oa.model.entity.OaOrgClassify;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
@Mapper
public interface OrgClassifyMapper {


    @Insert("insert into oa_org_classify (" +
            "classifyName," +
            "classifyPid" +
            ") " +
            "values " +
            "(" +
            "#{business.classifyName}," +
            "#{business.classifyPid}" +
            ")" )
    int insert(@Param("business") OaOrgClassify business);


    @Update("update oa_org_classify set classifyName = #{org.classifyName}, classifyPid=#{org.classifyPid} where classifyId = #{org.classifyId}")
    int update(@Param("org") OaOrgClassify org);


    @Delete("delete from oa_org_classify where classifyId=#{id}")
    void delete(@Param("id") Long id);


    @Select("select * from oa_org_classify where classifyPid = #{pid}")
    List<OaOrgClassify> list(@Param("pid") Long pid);


    @Select("select * from oa_org_classify where classifyId = #{id} limit 1")
    OaOrgClassify findOne(@Param("id") Long id);

}
